package com.wangshouyu.mp.pay.v3.callback;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author 王守钰
 * @program wsy-mp-pay
 * @date 2020年08月15日 00:58
 * @description: 支付回调通知数据
 */
public class PayCallbackResource implements Serializable {

    /**
     * 加密算法类型
     */
    @SerializedName(value = "algorithm")
    @JsonProperty(value = "algorithm")
    @JSONField(name = "algorithm")
    private String algorithm;

    /**
     * 数据密文
     */
    @SerializedName(value = "ciphertext")
    @JsonProperty(value = "ciphertext")
    @JSONField(name = "ciphertext")
    private String cipherText;

    /**
     * 附加数据
     */
    @SerializedName(value = "associated_data")
    @JsonProperty(value = "associated_data")
    @JSONField(name = "associated_data")
    private String associatedData;

    /**
     * 随机串
     */
    @SerializedName(value = "nonce")
    @JsonProperty(value = "nonce")
    @JSONField(name = "nonce")
    private String nonce;

    public String getAlgorithm() {
        return algorithm;
    }

    public void setAlgorithm(String algorithm) {
        this.algorithm = algorithm;
    }

    public String getCipherText() {
        return cipherText;
    }

    public void setCipherText(String cipherText) {
        this.cipherText = cipherText;
    }

    public String getAssociatedData() {
        return associatedData;
    }

    public void setAssociatedData(String associatedData) {
        this.associatedData = associatedData;
    }

    public String getNonce() {
        return nonce;
    }

    public void setNonce(String nonce) {
        this.nonce = nonce;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        PayCallbackResource that = (PayCallbackResource) o;
        return Objects.equals(algorithm, that.algorithm) &&
                Objects.equals(cipherText, that.cipherText) &&
                Objects.equals(associatedData, that.associatedData) &&
                Objects.equals(nonce, that.nonce);
    }

    @Override
    public int hashCode() {
        return Objects.hash(algorithm, cipherText, associatedData, nonce);
    }

    @Override
    public String toString() {
        return "PayCallbackResource{" +
                "algorithm='" + algorithm + '\'' +
                ", cipherText='" + cipherText + '\'' +
                ", associatedData='" + associatedData + '\'' +
                ", nonce='" + nonce + '\'' +
                '}';
    }
}
